package edu.scau.comeva.rigcontrol.model;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Set;

/**
 * Created with IntelliJ IDEA.
 * User: Dan
 * Date: 13-8-15
 * Time: 下午11:21
 * To change this template use File | Settings | File Templates.
 */
@Table
@Entity
public class m_right implements Serializable {
    private long rig_id;
    private String rig_name;
    private Set<m_role> rig_roles;
    private Set<m_resource> rig_resources;

    @Id
    @GeneratedValue
    public long getRig_id() {
        return rig_id;
    }

    public void setRig_id(long rig_id) {
        this.rig_id = rig_id;
    }

    public String getRig_name() {
        return rig_name;
    }

    public void setRig_name(String rig_name) {
        this.rig_name = rig_name;
    }

    @ManyToMany(mappedBy = "role_rights",cascade = CascadeType.ALL)
    public Set<m_role> getRig_roles() {
        return rig_roles;
    }

    public void setRig_roles(Set<m_role> rig_roles) {
        this.rig_roles = rig_roles;
    }

    @OneToMany(mappedBy = "res_right",cascade = CascadeType.ALL)
    public Set<m_resource> getRig_resources() {
        return rig_resources;
    }

    public void setRig_resources(Set<m_resource> rig_resources) {
        this.rig_resources = rig_resources;
    }
}
